from django.conf.urls import url
from . import views

urlpatterns = [
    # 注册页面子路由
    url(r'^register/$', views.RegisterView.as_view(), name='register'),

    #检验用户名重复注册子路由
    url(r'^usernames/(?P<username>[a-zA-Z0-9_]{5,20})/$', views.UsernameCountView.as_view(), name='usernamecount'),

    #检验手机号重复注册子路由
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/$', views.MobileCountView.as_view(), name='mobilecount'),

    #登录页面子路由
    url(r'^login/$', views.LoginView.as_view(), name='login'),

    #退出页面子路由
    url(r'^logout/$', views.LogoutView.as_view(), name='logout'),

    #判断用户是否登陆子路由
    url(r'^info/$', views.UserInfoView.as_view(), name='info'),

    #添加邮箱子路由
    url(r'^emails/$', views.EmailView.as_view(), name='email'),

    #激活邮箱子路由
    url(r'^emails/verification/$', views.EmailVerifyView.as_view(), name='emailverify'),

    #收货地址子路由
    url(r'^address/$',views.AddressView.as_view(),name='address'),

    #新增收货地址子路由
    url(r'^addresses/create/$',views.CreateAddressView.as_view(),name='createaddress'),

    #修改和删除收货地址子路由
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyAddressView.as_view(),name='updateaddress'),

    #设置默认地址
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view(),name='defaultaddress'),

    #设置地址标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view(),name='titleaddress'),

    #修改密码
    url(r'^changepassword/$', views.ChangePasswordView.as_view(),name='changepassword'),

    #用户浏览记录
    url(r'^browse_histories/$', views.UserBrowseHistory.as_view(),name='changepassword'),
]